export class CreateSymbol {
  constructor() {}

  // 创建点的图片标记
  createPointPictureMarker(url, width, height, xoffset, yoffset) {
    var symbol = {
      type: 'picture-marker', // autocasts as new PictureMarkerSymbol()
      url,
      width,
      height,
      xoffset,
      yoffset,
    }
    return symbol
  } // end createPointMarker

  // 创建简单的点标记
  createPointSimpleMarkerSymbol() {
    var symbol = {
      type: 'simple-marker',
      style: 'square',
      color: 'blue', // [226, 119, 40]
      path: '/src/assets/imgs/gps.svg', // The SVG path of the icon,只在2D 不支持IE11
      size: '8px', // pixels
      // xoffset,
      // yoffset,
      outline: {
        color: [255, 255, 0],
        width: 3, // points
      },
    }
    return symbol
  } // end createPointSimpleMarkerSymbol

  // 创建简单的线样式
  createLineSymbol3D() {
    const symbol = {
      type: 'line-3d', // autocasts as new LineSymbol3D()
      // Symbol3DLayer type
      symbolLayers: [
        {
          // autocasts as new PathSymbol3DLayer()
          type: 'path', // icon,object,line,path,fill,water,extrude,text
          profile: 'circle',
          width: 10, // width of the tube in meters
          material: { color: [128, 128, 128] },
        },
      ],
    }
    return symbol
  } // end createLineSymbol3D

  // 创建简单的线样式
  createSimpleLineSymbol(color, width, style) {
    const symbol = {
      type: 'simple-line',
      color,
      width,
      style,
    }
    return symbol
  }
  /**
   *
   * @param {*} color :Array--[0, 255, 0] || string --"green"--"#00FF00"--"rgba(0, 255, 0, 0.5)"
   * @param {*} style :string
   * @param {*} outline :Object
   */
  createSimpleFillSymbol(color, style, outlineColor, outlineWidth) {
    const symbol = {
      type: 'simple-fill', // autocasts as new SimpleFillSymbol()
      color,
      style: style || 'solid',
      outline: {
        // autocasts as new SimpleLineSymbol()
        color: outlineColor || 'black',
        width: outlineWidth,
      },
    }
    return symbol
  }
}
